﻿#region Imports
using System;
using CommonUtilities.Enums;
#endregion

namespace CommonUtilities.Attributes
{
    [AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
    public class ConstraintAttribute : Attribute
    {
        #region Declaration
        /// <summary>
        /// Default value for Constraint property
        /// </summary>
        private const eConstraint defaultConstraint = eConstraint.Recommended;

        /// <summary>
        /// Default property name
        /// </summary>
        public static readonly string DefaultPropertyName = "Constraint";

        /// <summary>
        /// Specifies the default instance for the <code>CommonUtilities.Attributes.ConstraintAttribute</code>
        /// </summary>
        public static readonly ConstraintAttribute Default = new ConstraintAttribute() { Constraint = defaultConstraint };

        /// <summary>
        /// Specifies the default value for the <code>CommonUtilities.Attributes.ConstraintAttribute.Constraint</code> when property not attributed to
        /// </summary>
        public static readonly eConstraint DefaultValueOnAbsent = Default.Constraint;
        #endregion

        #region Properties
        public eConstraint Constraint { get; set; }
        #endregion Properties

        #region Constructors
        public ConstraintAttribute()
            : base()
        {

        }

        public ConstraintAttribute(eConstraint constraint)
            : this()
        {
            Constraint = constraint;
        }
        #endregion Constructors
    }
}
